package com.gxxy.spring.kp01_hellospring;

import org.junit.Test;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

@SuppressWarnings("deprecation")
public class HelloSpringTest {
	
	private Resource resource = new ClassPathResource("application.xml");
	//String path = "file:///D:/Development/JavaCode/SSH/Demo_SpringStudy/resource/application.xml";
	//private Resource resource = new FileSystemResource(path);
	
	// 启动Spring的框架
	BeanFactory factory = new XmlBeanFactory(resource);
	
	//IHelloSpring hello = new HelloSpring();
	
	@Test
	public void testHellSpring() throws Exception {
		IHelloSpring helloBean = factory.getBean("helloSpringBean", IHelloSpring.class);
		helloBean.sayHello();
	}
	
}

/* Bean: 放在Spring容器中的对象都是Bean
 * 
 * 
 * 面向接口编程
 * 什么是面向接口编程? -> 面向接口编程能解决什么问题?
 * 解耦
 * 
 * Ioc/DI
 * Inverse of Control: 控制反转
 * DI: Dependent Injection: 依赖注入
 * 
 * 
 * 
 */
